1.21.1 neoforge initial clusterfuck#814
Conversation
…uck' into 1.21.1-neoforge-initial-clusterfuck
| //Curious: Gang idfk what to name this I'ma be so fr | ||
| //Curious TODO: Find a proper name for this event | ||
| @SubscribeEvent | ||
| public void triggerInertia(BlockEvent.BreakEvent event) { |
There was a problem hiding this comment.
could probably be just handleInertia, no need to overthink this
| } | ||
|
|
||
| //Curious: I'm like 90% sure this isn't needed anymore since Enchantments are stored as components now so I'm just commenting both instances of this | ||
| //Curious TODO: Look into whether enchantments still need this event check for the Indestructible enchant |
There was a problem hiding this comment.
i'd say yes simply because the current enchantable tag is just a generic one and not a negative tag for #spectrum:indestructible_blacklisted
There was a problem hiding this comment.
it could just be made to exclude #spectrum:indestructible_blacklisted though, we have exclusionslib specifically for that
There was a problem hiding this comment.
do note, however, that it's optional currently
There was a problem hiding this comment.
So I should be fine to delete that handler, yes?
There was a problem hiding this comment.
as long as you replace it with equivalent functionality
since exclusionslib is optional, i strongly advise you to write an equivalent handler
There was a problem hiding this comment.
I'll do that later then, need to look into spectrum's code more
There was a problem hiding this comment.
Neoforge has it's own tag exclusion mechanism: https://docs.neoforged.net/docs/resources/server/tags/, so we are good without a dedicated blacklist tag.
{
"values": [
...
],
"remove": [
"minecraft:iron_ingot"
]
}There was a problem hiding this comment.
that's really useful
| } | ||
|
|
||
| @SubscribeEvent | ||
| public void triggerJeopardentKillCriterion(LivingDeathEvent event) { |
There was a problem hiding this comment.
nit: Jeopardent -> Jeopardant
| // AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> { | ||
| // if (!world.isClientSide && !player.isSpectator()) { | ||
| // | ||
| // ItemStack mainHandStack = player.getMainHandItem(); | ||
| // if (mainHandStack.getItem() instanceof ExchangeStaffItem exchangeStaffItem) { | ||
| // BlockState targetBlockState = world.getBlockState(pos); | ||
| // if (exchangeStaffItem.canInteractWith(targetBlockState, world, pos, player)) { | ||
| // Optional<Block> storedBlock = ExchangeStaffItem.getStoredBlock(player.getMainHandItem()); | ||
| // | ||
| // if (storedBlock.isPresent() | ||
| // && storedBlock.get() != targetBlockState.getBlock() | ||
| // && storedBlock.get().asItem() != Items.AIR | ||
| // && ExchangeStaffItem.exchange(world, pos, player, storedBlock.get(), player.getMainHandItem(), true, direction)) { | ||
| // | ||
| // return InteractionResult.SUCCESS; | ||
| // } | ||
| // } | ||
| // world.playSound(null, player.blockPosition(), SoundEvents.DISPENSER_FAIL, SoundSource.PLAYERS, 1.0F, 1.0F); | ||
| // return InteractionResult.FAIL; | ||
| // } | ||
| // } | ||
| // return InteractionResult.PASS; | ||
| // }); | ||
|
|
||
| // CommonLifecycleEvents.TAGS_LOADED.register((registries, client) -> { | ||
| // if (client) { | ||
| // SpectrumColorProviders.resetToggleableProviders(); | ||
| // } | ||
| // }); | ||
|
|
||
| // PlayerBlockBreakEvents.AFTER.register((level, player, pos, state, blockEntity) -> { | ||
| // if (player instanceof ServerPlayer serverPlayerEntity) { | ||
| // ItemStack handStack = player.getItemInHand(serverPlayerEntity.getUsedItemHand()); | ||
| // if (SpectrumEnchantmentHelper.hasEnchantment(player.level().registryAccess(), SpectrumEnchantments.INERTIA, handStack)) { | ||
| // InertiaComponent.onInertiaBlockBreak(level, pos, state, serverPlayerEntity, handStack); | ||
| // } | ||
| // | ||
| // SpectrumAdvancementCriteria.BLOCK_BROKEN.trigger(serverPlayerEntity, state); | ||
| // } | ||
| // }); | ||
|
|
||
| // EnchantmentEvents.ALLOW_ENCHANTING.register((registryEntry, itemStack, enchantingContext) -> { | ||
| // if (registryEntry.is(SpectrumEnchantments.INDESTRUCTIBLE) && itemStack.is(SpectrumItemTags.INDESTRUCTIBLE_BLACKLISTED)) { | ||
| // return TriState.FALSE; | ||
| // } | ||
| // return TriState.DEFAULT; | ||
| // }); | ||
|
|
||
| // UseEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> { | ||
| // ItemStack handStack = player.getItemInHand(hand); | ||
| // if (handStack.getItem() instanceof PrioritizedEntityInteraction && entity instanceof LivingEntity livingEntity) { | ||
| // return handStack.interactLivingEntity(player, livingEntity, hand); | ||
| // } | ||
| // return InteractionResult.PASS; | ||
| // }); | ||
|
|
||
| // UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> { | ||
| // ItemStack handStack = player.getItemInHand(hand); | ||
| // if (handStack.getItem() instanceof PrioritizedBlockInteraction) { | ||
| // return handStack.useOn(new UseOnContext(player, hand, hitResult)); | ||
| // } | ||
| // return InteractionResult.PASS; | ||
| // }); | ||
| //I don't wanna mess with server stuff rn I'm not sure how this works | ||
| //TODO: Look into server code stuff so these can be handled |
| // EntitySleepEvents.STOP_SLEEPING.register((entity, sleepingPos) -> { | ||
| // // If the player wears a Whispy Cirlcet and sleeps | ||
| // // they get fully healed and all negative status effects removed | ||
| // // When the sleep timer reached 100 the player is fully asleep | ||
| // if (entity instanceof ServerPlayer serverPlayerEntity | ||
| // && serverPlayerEntity.getSleepTimer() == 100 | ||
| // && SpectrumTrinketItem.hasEquipped(entity, SpectrumItems.WHISPY_CIRCLET)) { | ||
| // | ||
| // entity.setHealth(entity.getMaxHealth()); | ||
| // WhispyCircletItem.removeNegativeStatusEffects(entity); | ||
| // } | ||
| // }); | ||
|
|
||
| // ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.register((world, entity, killedEntity) -> { | ||
| // if (entity instanceof ServerPlayer serverPlayerEntity && SpectrumTrinketItem.hasEquipped(serverPlayerEntity, SpectrumItems.JEOPARDANT)) { | ||
| // SpectrumAdvancementCriteria.JEOPARDANT_KILL.trigger(serverPlayerEntity, killedEntity); | ||
| // } | ||
| // }); | ||
| //Curious: This is too scary for me Daf |
There was a problem hiding this comment.
you literally did that above, remove this commented out code
There was a problem hiding this comment.
I forgot version control is a thing and I can just delete that I'm sorry
| import java.util.*; | ||
| import java.util.concurrent.atomic.*; | ||
|
|
||
| public class SpectrumEventListeners { |
There was a problem hiding this comment.
one more thing: @SubscribeEvent must be used in conjunction with @EventBusSubscriber, the only other way is manually registering event listeners to the bus
There was a problem hiding this comment.
Yeah I just forgot to do that, change has been made
|
👀 |
e7f38f2
into
DaFuqs:1.21.1-neoforge-initial-clusterfuck
I fucked up the other PR 😭 So rusty
Anyways I would like to say that the placement of these is very temporary most likely and they will be moved into more relevant classes.
I think I did okay? pls no kill